#!/bin/bash

# 换源
sudo sed -i s@/ports.ubuntu.com/@/mirrors.tuna.tsinghua.edu.cn/@g /etc/apt/sources.list 
sudo sed -i s@/security.ubuntu.com/@/mirrors.tuna.tsinghua.edu.cn/@g /etc/apt/sources.list 

sudo apt-get update --fix-missing


# 安装依赖
sudo apt-get -y install dkms nvidia-docker2 nvidia-container-runtime nvidia-container-toolkit htop net-tools


# docker 环境配置
sudo groupadd docker            #添加docker用户组
sudo gpasswd -a $USER docker    #将登陆用户加入到docker用户组中
newgrp docker                   #更新用户组

sudo systemctl daemon-reload    #重新加载systemd
sudo systemctl restart docker   #重启docker服务

